import request from '@/utils/request'

// 创建段别
export function createSegment(data) {
  return request({
    url: '/lamp/segment/create',
    method: 'post',
    data: data
  })
}

// 更新段别
export function updateSegment(data) {
  return request({
    url: '/lamp/segment/update',
    method: 'put',
    data: data
  })
}

// 删除段别
export function deleteSegment(id) {
  return request({
    url: '/lamp/segment/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除段别 */
export function deleteSegmentList(ids) {
  return request({
    url: `/lamp/segment/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得段别
export function getSegment(id) {
  return request({
    url: '/lamp/segment/get?id=' + id,
    method: 'get'
  })
}

// 获得段别分页
export function getSegmentPage(params) {
  return request({
    url: '/lamp/segment/page',
    method: 'get',
    params
  })
}
// 导出段别 Excel
export function exportSegmentExcel(params) {
  return request({
    url: '/lamp/segment/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}